package hcn.protocol.brandnew.zhenliao.yizhu;

import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateTimeAdapter;
import hcn.protocol.brandnew.BaseRequest;
import lombok.Data;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;


/**
 * 医嘱信息查询服务-请求消息 - ODS_03030003
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "MsgBody")
@XmlAccessorType(XmlAccessType.FIELD)
public class ListAllAdviceRequest extends BaseRequest {

    /**
     * 患者基本信息
     */
    @XmlElement(name = "Patient")
    private Patient patient;
    /**
     * 就诊摘要
     */
    @XmlElement(name = "Visit")
    private Visit visit;
    /**
     * 住院医嘱单
     */
    @XmlElement(name = "Advice")
    private Advice advice;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Patient {

        /**
         * 业务系统患者档案ID
         */
        @XmlElement(name = "SourcePatientId")
        private String sourcePatientId;
        /**
         * 业务系统患者档案类型
         */
        @XmlElement(name = "SourcePatientIdType")
        private String sourcePatientIdType;
        /**
         * 建档机构代码
         */
        @XmlElement(name = "AuthorOrganization")
        private String authorOrganization;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Visit {

        /**
         * 就诊机构代码
         */
        @XmlElement(name = "VisitOrganization")
        private String visitOrganization;
        /**
         * 住院号
         */
        @XmlElement(name = "VisitId")
        private String visitId;
        /**
         * 患者类型代码
         */
        @XmlElement(name = "PatientType")
        private String patientType;
        /**
         * 住院号
         */
        @XmlElement(name = "HospizationId")
        private String hospizationId;
        /**
         * 医嘱类别代码
         */
        @XmlElement(name = "AdviceTypeCode")
        private String adviceTypeCode;
        /**
         * 查询医嘱类型
         */
        @XmlElement(name = "QueryAdviceType")
        private String queryAdviceType;
        /**
         * 每页条数
         */
        @XmlElement(name = "PageSize")
        private Long pageSize;
        /**
         * 分页页数
         */
        @XmlElement(name = "PageNo")
        private Long pageNo;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Advice {

        /**
         * 医嘱单序号
         */
        @XmlElement(name = "AdviceId")
        private String adviceId;
        /**
         * 注册责任人标识
         */
        @XmlElement(name = "PersonLiable")
        private String personLiable;
        /**
         * 开立医师代码
         */
        @XmlElement(name = "AdviceOpenerCode")
        private String adviceOpenerCode;
        /**
         * 医嘱项目类型代码
         */
        @XmlElement(name = "AdviceItemType")
        private String adviceItemType;
        /**
         * 医嘱开立日期时间(起始)
         */
        @XmlElement(name = "AdviceOpenDateTime_B")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date adviceOpenDateTimeB;
        /**
         * 医嘱开立日期时间(截止)
         */
        @XmlElement(name = "AdviceOpenDateTime_E")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date adviceOpenDateTimeE;
    }

}
